import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkVO, ParkForm, ParkQuery } from '@/api/cemetery/park/types';

/**
 * 查询墓穴园区列表
 * @param query
 * @returns {*}
 */

export const listPark = (query?: ParkQuery): AxiosPromise<ParkVO[]> => {
  return request({
    url: '/cemetery/park/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询墓穴园区详细
 * @param id
 */
export const getPark = (id: string | number): AxiosPromise<ParkVO> => {
  return request({
    url: '/cemetery/park/' + id,
    method: 'get'
  });
};

/**
 * 新增墓穴园区
 * @param data
 */
export const addPark = (data: ParkForm) => {
  return request({
    url: '/cemetery/park',
    method: 'post',
    data: data
  });
};

/**
 * 修改墓穴园区
 * @param data
 */
export const updatePark = (data: ParkForm) => {
  return request({
    url: '/cemetery/park',
    method: 'put',
    data: data
  });
};

/**
 * 删除墓穴园区
 * @param id
 */
export const delPark = (id: string | number | Array<string | number>) => {
  return request({
    url: '/cemetery/park/' + id,
    method: 'delete'
  });
};
